//
//  BaseViewController.m
//  PlayCatchGame
//
//  Created by 流言 on 2018/1/15.
//  Copyright © 2018年 清正. All rights reserved.
//

#import "BaseViewController.h"
#import "PublishCircleVC.h"
#import "ImageItemView.h"

@interface BaseViewController () {
    CGFloat WIDTH_KOne;
    CGFloat HEIGHT_KOne;
    PublishCircleVC *imageVc;
    NSMutableArray *selectImageArray;
}
@property (strong, nonatomic) ImageItemView *imageView;

@end

@implementation BaseViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    WIDTH_KOne =[[UIScreen mainScreen] bounds].size.width;
    HEIGHT_KOne =[[UIScreen mainScreen] bounds].size.height;
    /// 控制状态栏颜色 需 info.plist:[Status bar style = UIStatusBarStyleLightContent] 或 [View controller-based status bar appearance = NO]
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (UIButton *)showNavigatioBarSeat:(BaseBarItemDirection)direction withImage:(UIImage*)image {
    UIButton *navItem =[UIButton buttonWithType:UIButtonTypeCustom];
    
    navItem.frame = CGRectMake(0, 0, WIDTH_K/5, 44);
    navItem.adjustsImageWhenHighlighted =NO;
    [navItem setImage:image forState:UIControlStateNormal];
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:navItem];
    if (direction ==BaseBarItemDirectionLeft) {
        navItem.contentHorizontalAlignment =UIControlContentHorizontalAlignmentLeft;
        self.navigationItem.leftBarButtonItem= item;
        [navItem addTarget:self action:@selector(barItemLeftButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    } else {
        navItem.contentHorizontalAlignment =UIControlContentHorizontalAlignmentRight;
        self.navigationItem.rightBarButtonItem= item;
        [navItem addTarget:self action:@selector(barItemRightButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return navItem;
}
- (UIButton *)showNavigatioBarSeat:(BaseBarItemDirection)direction withTitle:(NSString*)title {
    UIButton *navItem =[UIButton buttonWithType:UIButtonTypeCustom];
    navItem.frame = CGRectMake(0, 0, WIDTH_K/5, 44);
    [navItem setTitle:title forState:UIControlStateNormal];
    navItem.titleLabel.font =[UIFont systemFontOfSize:16];
    [navItem setTitleColor:[UINavigationBar appearance].tintColor forState:UIControlStateNormal];
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:navItem];
    if (direction ==BaseBarItemDirectionLeft) {
        navItem.contentHorizontalAlignment =UIControlContentHorizontalAlignmentLeft;
        self.navigationItem.leftBarButtonItem= item;
        [navItem addTarget:self action:@selector(barItemLeftButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    } else {
        navItem.contentHorizontalAlignment =UIControlContentHorizontalAlignmentRight;
        self.navigationItem.rightBarButtonItem= item;
        [navItem addTarget:self action:@selector(barItemRightButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return navItem;
}

- (void)barItemLeftButtonClick:(UIButton*)button {
    NSLog(@"左导航按钮 需重写此方法");
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)barItemRightButtonClick:(UIButton*)button {
    NSLog(@"右导航按钮 需重写此方法");
    
}

- (void)networkChange:(NSNotification*)notificat {
    NSLog(@"网路变化 需重写此方法");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
